package net.discard.model.vo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.discard.model.Activity;
import net.discard.model.jy.enums.PowerEnum;
import net.discard.model.jy.enums.TopicEnum;
import net.discard.model.jy.enums.TypeEnum;
import net.discard.model.jy.enums.WeightEnum;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author: Discard
 * @Date: 2021/2/19 4:33 下午
 */
public class ActivityVo {

    private long id;

    private String title;

    private String image;

    private Date startDate;

    private int days;

    private String topic;

    private String type;

    private String age;

    private String power;

    private String weight;

    private String content;

    public ActivityVo(Activity activity) {
        this.id = activity.getId();
        this.title = activity.getTitle();
        this.image = activity.getImage();
        this.startDate = activity.getStartDate();
        this.days = activity.getDays();
        this.topic = TopicEnum.getValue(activity.getTopic());
        this.type = TypeEnum.getValue(activity.getType());
        this.age = activity.getAge();
        this.power = PowerEnum.getValue(activity.getPower());
        this.weight = WeightEnum.getValue(activity.getWeight());
        this.content = activity.getContent();
    }

    public static List<ActivityVo> voList(List<Activity> activityList){
        List<ActivityVo> list = new ArrayList<>();
        for (Activity activity : activityList){
            list.add(new ActivityVo(activity));
        }
        return list;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public int getDays() {
        return days;
    }

    public void setDays(int days) {
        this.days = days;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getPower() {
        return power;
    }

    public void setPower(String power) {
        this.power = power;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}
